import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: () => import('@/views/dashed/index.vue')
    },
    {
      path: '/table/:id',
      name: 'table',
      component: () => import('@/views/table/index.vue'),
      props: true
    },
    {
      path: '/pay',
      name: 'pay',
      component: () => import('@/views/pay/index.vue'),
      props: true,
      children: [
        {
          path: 'success',
          name: 'paySuccess',
          component: () => import('@/views/pay/success/index.vue')
        },
        {
          path: 'await',
          name: 'payAwait',
          component: () => import('@/views/pay/await/index.vue')
        },
        {
          path: 'paynow',
          name: 'paynow',
          component: () => import('@/views/pay/paynow/index.vue')
        }
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: () => import('@/views/login/index.vue'),
      meta: { noHeaderAndUser: true }
    },
    {
      path: '/user',
      name: 'User',
      component: () => import('@/views/user/index.vue')
    },
    {
      path: '/admin',
      name: 'Admin',
      component: () => import('@/views/admin/index.vue'),
      meta: { noUser: true }
    }
  ]
})

export default router
